home *** CD-ROM | disk | FTP | other *** search
-
- #pragma once
-
- #include <LApplication.h>
-
- #include "NetSprocket.h"
- #include <LArray.h>
- #include <LComparator.h>
- #include <LWindow.h>
-
- typedef struct TKeyState
- {
- TNetMessageHeader h;
- UInt32 keyMap[4];
- UInt32 pulseBit;
- } TKeyState;
-
- UInt32 gPulseBit;
-
- typedef struct PlayerListItem
- {
- TPlayerID player;
- LWindow *window;
- } PlayerListItem;
-
- class CPlayerListComparator : LComparator
- {
- public:
- CPlayerListComparator() {}
- ~CPlayerListComparator() {}
- virtual Int32 Compare(
- const void* inItemOne,
- const void* inItemTwo,
- Uint32 inSizeOne,
- Uint32 inSizeTwo) const;
-
- virtual Boolean IsEqualTo(
- const void* inItemOne,
- const void* inItemTwo,
- Uint32 inSizeOne,
- Uint32 inSizeTwo) const;
- virtual Int32 CompareToKey(
- const void* inItem,
- Uint32 inSize,
- const void* inKey) const;
-
- virtual Boolean IsEqualToKey(
- const void* inItem,
- Uint32 inSize,
- const void* inKey) const;
-
-
- };
-
-
- class PPTestApp : public LApplication {
- public:
- PPTestApp(); // constructor registers all PPobs
- virtual ~PPTestApp(); // stub destructor
-
- // this overriding function performs application functions
-
- virtual void ProcessNextEvent(void);
- virtual Boolean ObeyCommand(CommandT inCommand, void* ioParam);
-
- // this overriding function returns the status of menu items
-
- virtual void FindCommandStatus(CommandT inCommand,
- Boolean &outEnabled, Boolean &outUsesMark,
- Char16 &outMark, Str255 outName);
- protected:
-
- virtual void StartUp(); // overriding startup functions
- void HandleGameEvent(TNetMessageHeader *inEvent);
- void HandlePlayerJoined(TPlayerJoinedMessage *inEvent);
- void HandlePlayerLeft(TPlayerLeftMessage *inEvent);
- void HandleGameStart(TNetMessageHeader *inEvent);
- void HandleGamePause(TNetMessageHeader *inEvent);
- void HandleGameEnd(TNetMessageHeader *inEvent);
- void HandleKeyboardState(TKeyState *inEvent);
-
- TNetGameObject theGame;
- Boolean bAdvertising;
- Boolean bHost;
- Boolean bRunning;
- UInt32 mPlayerCount;
- TPlayerID mPlayerID;
- LArray *mPlayerList;
-
- };